<%@ page language="java" contentType="text/html;charset=UTF-8"
   	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<script>
	function trim(stringToTrim) {
		return stringToTrim.replace(/^\s+|\s+$/g,"");
	}
	function ltrim(stringToTrim) {
		return stringToTrim.replace(/^\s+/,"");
	}
	function rtrim(stringToTrim) {
		return stringToTrim.replace(/\s+$/,"");
	}
	function Validate(){
		var title=document.getElementById("txttitle").value;
		if(trim(title)==""){
			alert("Please enter title");
			document.getElementById("txttitle").focus();
			return false;
		}
		return true;
	}
</script>
<form action="update_myuploads.html" method="post" onsubmit="return Validate();" >
<table cellpadding="0" cellspacing="0" width="600" align="center" border="0" style="color: #333;">
<c:forEach var="x" begin="0" end="${fn:length(data)-1}" step="1" varStatus ="status">
	<tr align="center"><td colspan="2" height="30" style="font-size:13px;"><u>កែប្រែឯកសារ</u></td></tr>
	<tr><td colspan="2"><input name="txtid" type="hidden" value="${data[x].FILE_ID}"/></td></tr>
	<tr>
		<td width="120" height="30" align="right" class="mylabel">ឈ្មោះ File :&nbsp;</td>	
		<td width="" align="left"><a href="${weburl}${data[x].FILE_PATH}${data[x].FILE_NAME}">${data[x].FILE_NAME}</a></td>
	</tr>
	<tr>
		<td  height="30" align="right" class="mylabel">ចំណងជើង :&nbsp;</td>	
		<td  align="left"><input name="txttitle" id="txttitle" maxlength="255" style="width: 300px;" class="box" type="text" value="${data[x].FILE_TITLE}"></td>
	</tr>
	<tr>
		<td height="30" align="right" class="mylabel">ប្រភេទ :&nbsp;</td>	
		<td align="left">
			<select name="txtcat" style="height:20px; width: 305px;">
				<c:forEach var="i" begin="0" end="${fn:length(categories)-1}" step="1" varStatus ="status">
					<c:choose>
						<c:when test="${data[x].CATEGORY_ID==categories[i].CATEGORY_ID}">
							<option selected="selected" value="${categories[i].CATEGORY_ID}"><c:out value="${categories[i].CATEGORY_NAME}"/></option>			
						</c:when>
						<c:otherwise>
							<option value="${categories[i].CATEGORY_ID}"><c:out value="${categories[i].CATEGORY_NAME}"/></option>			
						</c:otherwise>
					</c:choose>
				</c:forEach>
			</select>
		</td>
	</tr>
	<tr><td colspan="2" height="5"> </td></tr>
	<tr>
		<td align="right" class="mylabel">បរិយាយ :&nbsp;</td>	
		<td align="left"><textarea name="txtdesc" rows="10" style="font-family: verdana, sans-serif;font-size:11px;width: 400px;"><c:out value="${data[x].FILE_DESC}"></c:out></textarea></td>
	</tr>
	<tr><td colspan="2" height="8"> </td></tr>
	<tr>
		<td height="30" valign="top" align="right" style="padding-top: 4px; " class="mylabel">ពាក្យគន្លឹះ :&nbsp;</td>	
		<td align="left">
		<input type="text" id="txtkeyword" value="${keywords}" name="txtkeyword" maxlength="255" style="width: 300px;" class="box"/>
		<br><span style="font-size: 9px; color: #333; ">ឧទាហរណ៍. Business Administration ; Financial Management</span>
		</td>
	</tr>
	<tr><td colspan="2" height="5"> </td></tr>
	<tr>
		<td colspan="2" align="center" height="30"><input type="submit" value="កែប្រែ" class="input_button">&nbsp;&nbsp;<input type="button" onclick='window.location="myuploads.html"' value="បោះបង់" class="input_button"></td>
	</tr>
	<tr><td colspan="2" height="25">&nbsp;</td></tr>
</c:forEach>
</table>
</form>
